Image processing method

ABSTRACT

A method for processing images is useful for generating a chain code representation of a configuration of pixels in an image. The method stores a pixel representation in first frame memory. For each pixel, &#34;convolution information&#34; is stored in a second frame memory. Convolution information indicates whether neighborhood pixels are part of the configuration. In one embodiment, convolution information for an object pixel is a bit string. The location of a bit in the string corresponds to a direction of displacement from the object pixel. The value of a bit in the string indicates whether a neighborhood pixel located in the corresponding direction is part of the configuration. A first method for generating a chain code expression examines the convolution information for a bit which identifies an adjacent configuration pixel. Examination begins from a bit location determined from a prior code in the chain. The position of the identified bit is then the next code in the chain. An alternate method uses a look-up table. The address of the look-up tab is the convolution information expression, and the content of the table is a chain code.

BACKGROUND

The present invention relates to methods for processing images and forgenerating chain code representations of images.

A configuration of pixels in an image may be represented as a series ofvectors. Each vector represents a unit displacement in a predetermineddirection and is referred to as a chain element. The series of vectorsis called an "indexed sequence" or "chain code." The coordinates of eachconnected point are called chain coordinates.

The process of expressing an image as a series of vectors is generallycalled "chain coding." Chain coding is useful for representing imagesusing a minimum amount of storage.

FIG. 1 illustrates a conventional method for generating a chain coderepresentation of a configuration in an image. A pixel representation isscanned in a raster scan order. The first configuration pixelencountered during scanning, designated as pixel A, serves as thestarting point for the chain code representation. The chain coderepresentation will be a series of vectors tracing the boundary of theconfiguration in a clockwise or anti-clockwise direction. A method fortracing the boundary in an anti-clockwise direction is described as aseries of steps as follows.

(a) Pixels around A are searched to locate another pixel of theconfiguration. Searching begins with the pixel below and to the left ofpixel A and advances in an anti-clockwise direction. Since a line aboveA was previously scanned, no pixels of the configuration exist above A.Since a line is scanned from left to right, no pixels of theconfiguration exist to the left of A. In the example of FIG. 1, thepixel below and to the left of pixel A (in the direction labeled al) isevaluated first, but is not a pixel of the configuration. Advancing inan anti-clockwise direction, the pixel below pixel A (in a directionlabeled a2) is evaluated second. This second pixel is part of theconfiguration, and is labeled as pixel B.

(b) Pixels around B are searched to locate another pixel of theconfiguration. Searching begins with the pixel to the left of B when thedirection from pixel A to pixel B is downward. (The upward pixel A neednot be searched, and the location to the left of A was evaluated beforelocating A as a starting point.) Searching advances in an anti-clockwisedirection. In the illustration of FIG. 1, a pixel of the configurationbelow and to the left of B would be found. That pixel is labeled aspixel C.

(c) After each new pixel is located, searching continues around the newpixel. When the new pixel is located in a horizontal or verticaldirection from the previous pixel, searching begins from a pixel whichis located two pixels around from previous pixel in the anti-clockwisedirection. When the new pixel is located in a diagonal direction fromthe previous pixel, searching begins from a pixel which is located threepixels around from the previous pixel in the anti-clockwise direction.The chain code is completed when the process returns to pixel A.

(d) After completing a chain code representation for the configuration,the method resumes scanning the image in raster scan order beginningwith pixel X (in search of a new configuration).

As can be recognized from the process described above, an image storedas raw pixel values is an inconvenient form from which to generate achain code representation.

SUMMARY

The present invention relates to methods for generating chain coderepresentations of configurations of pixels in an image. The boundary ofa configuration can be represented as a series of chain code, each codeconnecting one boundary pixel to an adjacent boundary pixel. In oneaspect of the invention, each boundary pixel of the configuration isgiven an eight bit sequence (referred to a convolution information). Ina second aspect of the invention, chain codes are obtained from theeight bit sequences.

A hardware circuit generates an eight bit sequence for boundary pixelsof the image. For any such pixel (referred to as an object pixel), theeight bits provide information about eight pixels adjacent to the objectpixel. The value of each bit indicates whether the adjacent pixel is (oris not) part of the same configuration as the object pixel. For example,a value "1" in a bit position indicates that the pixel located in acertain direction is part of the same configuration as the object pixel.

A chain code for an object pixel is obtained based on its eight bitsequence and the prior code in the chain. The eight bit sequence isexamined beginning at a selected bit position. The beginning bitposition is determined from the prior code in the chain. The eight bitsequence is examined in a selected order until a bit is found which hasa value indicating that a pixel located in a certain direction is partof the same configuration. The chain code for the object pixel is thebit position identified in this manner.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a portion of a configuration of pixels illustrating amethod for generating chain codes.

FIG. 2 illustrates an image containing two configurations suitable forrepresentation by chain codes.

FIG. 3 illustrates labels of pixels of FIG. 2.

FIG. 4 illustrates eight directions from an object pixel to locations ofadjacent pixels and numeric identifiers for each direction.

FIG. 5 illustrates a circuit for generating convolution information.

FIG. 6 illustrates a logic network from FIG. 5.

FIG. 7 is a flow diagram illustrating steps of a first method forobtaining a chain code from convolution information.

FIG. 8 is a flow diagram illustrating steps of a second method forobtaining a chain code from convolution information.

DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 2 illustrates pixels in an image having two configurations. Pixelsof the first configuration are designated with a labeling number "1",pixels of the second configuration are designated with a labeling number"2" and pixels which are not part of either configuration are designatedwith a labeling number "0".

Boundary pixels define the contours of each configuration. In order tojudge whether a pixel is (or is not) a boundary pixel it is necessary tocompare the pixel being judged (referred to here as the object pixel)with neighboring pixels. For example, A "4-neighborhood," includespixels immediately above, below, to the right and to the left of anobject pixel. The object pixel is compared to neighborhood pixels todetermine whether the densities of each neighborhood pixel are differentfrom or the same as the object pixel.

When generating chain codes, it is necessary to determine connectivityof an object pixel with up to eight adjacent pixels ("8-neighborhood").

FIG. 3 illustrates a labeling arrangement for pixels in the image ofFIG. 2. Each pixel is designated with a unique label. Pixels of thefirst configuration are designated with the letter A followed by anumber. The number sequence is the order in which a raster scan wouldencounter the pixels Similarly, pixels of the second configuration aredesignated with the letter B followed by a number. Background pixels aredesignated by the letter C followed by a number.

FIG. 4 shows numeral designations of eight directions. For example,numeral 1 designates a direction to the right, numeral 2 designates adirection up and to the right, and numerals 3-8 designate directionsadvancing in an anti-clockwise rotation. It may be noted that chaincodes traditionally use numerals 0 through 7 with 0 indicating adirection directly to the right, numeral 1 indicating a direction up andto the right, and numerals 2-7 advancing in an anti-clockwise rotation.

Table 1 records information about the coincidence of each pixel in thefirst configuration and pixels in each respective neighborhood. Columnslabeled as 1 to 8 correspond to the eight directions of FIG. 4. Rowslabeled as A1 to A19 corresponds to pixels in the first configuration.An entry of "1" in a row/column intersection indicates that aneighboring pixel has the same density as the object pixel. An entry of"0" indicates that a neighboring pixel has a different density. Forexample, Row A1 has "1" entries in columns 6, 7 and 8. These "1" entriesindicate that pixels in directions 6, 7 and 8 from pixel A1 have thesame density as pixel A1. An inspection of FIG. 3 verifies that pixelsA3, A4 and A5 are part of the first configuration as A1 (indicating thatthey have the same densities).

Table 2 records information about the coincidence of pixels in thesecond configuration. Table 3 records information about the coincidenceof pixels which are neither part of the first nor the secondconfigurations. An entry "--" indicates that the row-pixel is on theimage edge (and does not have a complete neighborhood). It is alsopossible to define edge pixels in other ways.

"Convolution information" refers to information which indicates thedifference (or coincidence) between object pixels and pixels of theirneighborhoods. Convolution information may be defined for8-neighborhoods or 4-neighborhoods. Tables 1, 2 and 3 are examples of"convolution information" for an 8-neighborhood.

Circuits shown in FIGS. 5 and 6 rapidly generate convolutioninformation. The circuit of FIG. 5 includes two line memories 5,6connected in series. Each line memory has capacity for holding one scanline from an image. As an image is scanned (or as a frame memory holdinga pixel representation of an image is scanned), a first scan line ofpixel values is input to the first line memory 5 through a signal line7A. As a second scan line is input to the first line memory, pixels fromthe first line memory 5 are input to the second line memory 6 throughsignal line 8A. That is to say, pixels of the of the first scan lineadvance to the second line memory 6. As a third scan line is input tothe first line memory, pixels from the first memory advance to thesecond line memory, and pixels of the second line memory are output on asignal line 9A. Thus, as third line of the image is scanned, pixels fromthe prior two scan lines are output from the first and second linememories 5,6.

The circuit of FIG. 5 also includes three delay networks 7,89. Pixelvalues on signal lines 7A are input into delay network 7. Delay network7 includes two D-type flip flops 7B,7C. A pixel value is input into thefirst flip flop 7A on a first clock cycle. As a second pixel value isinput into the first flip flop 7B, the first pixel value advances intothe second flip flop 7C. Similarly, pixel values output from the firstline memory 5 and the second line memory 6 are input into a second delaynetwork 8 and a third delay network 9 respectively. The second and thirddelay networks 8,9 include D-type flip flops 8B,8C and 9A,9B whichoperate in the same manner as flip flops 7B,7C of the first delaynetwork 7.

A center pixel may be designated as Pi,j where i and j are coordinates.The index j designates the scan line in which the pixel is located andthe index i designates position along the scan line. A 3×3 convolutionincludes pixels to the left and right of a center pixel P(i-1),j, Pi,jand P(i+1),j. The convolution also includes three pixels on the previousscan line P(i-1)(j-1), Pi,(j-1) and P(i-1,j-1), as well as three pixelson the following scan line P(i+1),(j+1), P(i+1),j, P(i+1),(j+1).

Delay networks 7,8,9 and line memories 5,6 are clocked such that theiroutputs present nine pixels of a 3×3 array (convolution) of the image toa logic network 10. For example, after a first and second scan line ofpixels have been input to the first line memory 5 (and the first scanline has advanced to the second line memory 6) a third scan line will beprocessed. As the first pixel of the third scan line is input to thefirst line memory 5, it is also clocked into the first flip flop 7B ofthe first delay network 7. At the same time, the first pixels of thefirst and second scan lines are clocked into the third and second delaynetworks 9,8 respectively. As a second pixel of the third scan line isinput into the first line memory 5, it is clocked into the first flipflop 7B and the first pixel of third scan line advances from the firstflip flop 7B to the second flip flop 7C. Similarly, first and secondpixels of the first and second scan lines advance through theirrespective delay networks. As a third pixel of the third scan line isplaced on signal line 7A, line memories 5,6 place the third pixels ofthe first and second scan lines on signal lines 8A and 8B. At this time,nine pixel values of a 3×3 convolution are presented to logic network 10as shown in FIG. 5.

Logic network 10 performs a logical comparison of the center pixel Pi,jwith other pixels of the convolution and places convolution informationfor Pi,j on signal lines BT1 -BT8. The logical formulas for each lineare as follows:

    BT1=Pi,j×P(i+1),j

    BT2=Pi,j×P(i+1)(j-1)

    BT3=Pi,j×Pi,(j-1)

    BT4=Pi,j×P(i-1),(j-1)

    BT5=Pi,j×P(i-1),j

    BT6=Pi,j×P(i-1),(j+1)

    BT7=Pi,j×Pi,(j+1)

    BT8=Pi,j×P(i+1),(j+1).

FIG. 6 shows a logic network 10 made of AND gates which is suitable forperforming logic on object pixels having a value of 1. Exclusive NORgates can be used for comparisons which are independent of the objectpixel value.

Convolution information can be stored in a frame memory. That is to say,the address of the memory corresponds to the pixel coordinates, and theaddress contents are the convolution information for the correspondingpixel. This organization allows immediate reading of convolutioninformation.

In the method of the present invention, a chain code for an object pixelis determined from a prior chain code and from convolution information.Convolution information and the prior chain code are each eight bitexpressions (or less). This contrasts with conventional methods whichcompare an eight bit object pixel value with each of up to five o sixother eight bit pixel values. Thus a process using the present inventionis simplified. Several processing methods are individually discussed.

Method 1

A chain code for an object pixel is determined by searching theconvolution information from selected starting bit position. An eightbit expression of convolution information may be designates as Ni. Thedirection of the previous pixel may be designated as k (a value between1 and 8 as shown in FIG. 4). If k is odd, Ni is examined beginning atthe k+ 2nd digit N(k+2). If k is even, Ni is examined beginning at thek+ 3rd digit N(k+3). Digits are examined in increasing order until avalue "1" is found. The digit so found corresponds to the chain code.

FIG. 7 is a flow chart diagraming steps of this method with BASICexpressions. In a decision step 21, k is tested to determine whether itis odd (where K is the direction code of the object pixel from theprevious pixel in the chain). If so, a process step 23 sets J to K+1. IfK is not odd, a process step 25 sets J to K+ 2. After setting J, aprocess step 27 defines X as a logical AND between Ni (all eight bits)and the value 2^(J). (The value 2^(J) has a "1" in the Jth position). Adecision step 29 test the value of X. If X=1 (indicating that Ni had a"1" in the Jth position), then a process step 31 equates the chain codefor the object pixel with the value J and the process is complete forthat object pixel. If X is not "1", then a process step 33 increments Jand examination of Ni repeats with the incremented value of J.

Method 2

The location of a "1" digit in convolution information is determined byshifting the eight bit convolution information expression. Theconvolution information Ni for an object pixel is first shifted to astart position. If the direction code k from the object pixel to theprevious pixel in the chain is odd, Ni is shifted K+ 1 digits to theright. If is even, Ni is shifted k+2 digits to the right. Shiftingcontinues until a "1" is detected in the least significant bit of theshifted expression. FIG. 8 is a flow chart diagraming steps of thismethod with C-language expressions.

Method 3

The chain code of an object pixel can be determined from a table look-upprocedure based on the convolution information and the direction code ofthe previous pixel in the chain.

Coding speed of methods of the present invention can be increased bylimiting the methods to boundary pixels. That is to say, backgroundpixels and pixels in the interior of a configuration need not beprocessed. Boundary pixels can be readily identified from the locationsof "0" digits in the convolution information. The presence of a "0" indigits of the 4-neighborhood (digits 1,3,5 or 6) indicates that theobject pixel is a boundary. If data is otherwise compressed, only datafor boundary pixels need be extracted.

Convolution information is also useful for identifying characteristicsof a chain code sequence. For example, information of the pixels in a4-neighborhood around an object pixel gives information about whetherthe object pixel forms part of a vertical or horizontal line across aconfiguration. For example Table 4 includes rows for differentconvolution information expressions. The second column (headed "7 5 31") has "0" and "1 " entries which are possible combinations ofconvolution information. The first column is a decimal numericcorresponding to each convolution information expression. The thirdcolumn has entries indicating whether a object pixel having thecorresponding convolution information is a start point, an end point ora middle point of a horizontal segment. The fourth column has entriesindicating whether a center point having the corresponding convolutioninformation is a start point, an end point or a middle point of avertical segment.

For example, an object pixel having convolution information "1 0 1 0"(10 decimal) has pixels directly above (direction 3) and below(direction 7). If this object pixel is part of a horizontal segment, itwould be a start or end point as indicated in the third column. If thisobject pixel is part of a vertical segment, it would be a middle pointas indicated in the fourth column.

Convolution information may be generated for sets of directions. Forexample, convolution information limited to directions 1, 2 and 8 can beused for chain coding a right edge.

It can be seen that convolution information in an 8-neighborhood issufficient for generating a chain code representation.

Storing pixel density data in a first frame memory and convolutioninformation in a second frame memory allows immediate access to bothsets of information.

I claim:
 1. A method for generating a chain code representation of aconfiguration of pixels in an image comprising steps of:generating apixel representation of the image; generating firstneighborhood-information expression for an object pixel of theconfiguration, said neighborhood-information expression representingcoincidence of density between the object pixel and pixels in aneighborhood around the object pixel; generating aneighborhood-information expression for each of a plurality of pixels ofthe configuration; storing said neighborhood-information expressions ina frame memory; obtaining a chain code representing the object pixelfrom the first neighborhood-information expression; and representing theconfiguration as a sequence of chain codes including a chain codeobtained from the first neighborhood-information expression.
 2. An imageprocessing method as in claim 1 wherein said convolution-informationexpression comprises four bits indicating density differences betweensaid object pixel and four adjacent pixels.
 3. An image processingmethod as in claim 1 wherein said convolution-information expressioncomprises eight bits indicating density differences between said objectpixel and eight adjacent pixels.
 4. An image processing method as inclaim 1, wherein said convolution information comprises an orderedstring of convolution-information bits, said convolution-informationbits indicating density differences between said object pixel and 8adjacent pixels.
 5. An image processing method as in claims 1 whereinsaid pixels in an image convolution information is stored in a firstframe memory, and pixel values of said object pixels are stored in asecond frame memory.
 6. A method as in claim 1 wherein the step ofgenerating a first convolution-information expression includes a step ofgenerating a first ordered string of bits, a location of a bit in theordered string corresponding to a direction in the image, a value of abit in the string indicating that a pixel adjacent to the object pixelin the corresponding direction is part of the configuration.
 7. A methodas in claim 6 wherein the step of obtaining a chain code representingthe object pixel from the first convolution-information expressionincludes a step of examining bits in the first ordered string beginningfrom a first position in the order, said first position determined froma chain code of a prior pixel in the configuration.
 8. A method as inclaim 6 wherein the step of obtaining a chain code representing theobject pixel from the first convolution-information expression includessteps of:storing the first ordered string in register; shifting thestring a plurality of times; and testing a first bit position in thestring after each shift.
 9. A method as in claim 6 wherein the step ofobtaining a chain code representing the object pixel from the firstconvolution-information expression includes steps of:generating andstoring a look-up table, said table addressed by theconvolution-information expression, the contents of said look-up tablecomprising chain codes.
 10. A method as in claim 6 wherein the step ofgenerating a first ordered string of bits includes steps of:storing afirst line of pixels in a first line memory; storing a second line ofpixels in a second line memory; storing a first pixel of a third line ofpixels in a first storage cell and storing a second pixel of the thirdline of pixels in a second storage cell; storing a first pixel of thesecond line of pixels in a third storage cell and storing a second pixelof the second line of pixels in a fourth storage cell; storing a firstpixel of the first line of pixels in a fifth storage cell and storing asecond pixel of the first line of pixels in a sixth storage cell; andlogically combining first, second and third pixels from each of thefirst, second and third lines of pixels thereby generating the firstordered string of bits.